package org.fangzz.cameramgr.cameramonitor.dto;

import org.fangzz.cameramgr.cameramonitor.model.City;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

public class CitySummary {

    private Integer id;
    private String code;
    private String name;
    private String provinceCode;

    public static CitySummary convert(City city){
        CitySummary citySummary = new CitySummary();
        BeanUtils.copyProperties(city,citySummary);
        return citySummary;
    }

    public static List<CitySummary> convert(List<City> cities){
        List<CitySummary> citySummaryList = new ArrayList<>();
        cities.stream().forEach(City->{
            citySummaryList.add(CitySummary.convert(City));
        });
        return citySummaryList;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCityCode() {
        return code;
    }

    public void setCityCode(String code) {
        this.code = code;
    }

    public String getCityName() {
        return name;
    }

    public void setCityName(String name) {
        this.name = name;
    }

    public String getProvinceCode() {
        return provinceCode;
    }

    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
}
